float4x4 BillboardingMat: register(c0);
float4x4 PVMat			: register(c4);

// The vertex shader input structure
struct VS_INPUT
{
	float4 Position : POSITION0;	// The position information
	float4 Color    :    COLOR0;
	float2 TexCoord : TEXCOORD0;	// The texture coordinates
	float  Scale	:	 PSIZE0;
};

// The vertex shader output structure
struct VS_OUTPUT
{
	float4 Position : POSITION0;	// The position information
	float4 Color    : COLOR0;	
	float2 TexCoord : TEXCOORD0;	// The texture coordinates
};

// Our vertex shader
VS_OUTPUT SecondaryVertexShader(VS_INPUT In)
{
	VS_OUTPUT Result;
	
	
	float4 pos;
	pos = float4(2.0f * In.TexCoord.x - 1.0f, 1.0f - 2.0f * In.TexCoord.y, 0.0f, 0.0f);
	pos *= In.Scale.x;
	
	pos.z = 0.0f;
	
	pos = mul(pos, BillboardingMat);
	
	pos += In.Position;		
	
 	pos.w = 1.0f;
 	
	Result.Position = mul( pos, PVMat);
	
	Result.TexCoord = In.TexCoord;						
	Result.Color    = In.Color;

	return Result;
}